package com.jeesite.modules.ocr.entity;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;


public class OcrTextBlock {
	private ArrayList<OcrPoint> boxPoint;
	private float boxScore;
	private int angleIndex;
	private float angleScore;
	private double angleTime;
	private String text;
	private float[] charScores;
	private double crnnTime;
	private double blockTime;

	public OcrTextBlock(
	            ArrayList<OcrPoint> boxPoint, float boxScore,
	            int angleIndex, float angleScore, double angleTime,
	            String text, float[] charScores, double crnnTime, double blockTime
	    ) {
	        this.boxPoint = boxPoint;
	        this.boxScore = boxScore;
	        this.angleIndex = angleIndex;
	        this.angleScore = angleScore;
	        this.angleTime = angleTime;
	        this.text = text;
	        this.charScores = charScores;
	        this.crnnTime = crnnTime;
	        this.blockTime = blockTime;
	    }

	public ArrayList<OcrPoint> getBoxPoint() {
		return boxPoint;
	}

	public float getBoxScore() {
		return boxScore;
	}

	public int getAngleIndex() {
		return angleIndex;
	}

	public float getAngleScore() {
		return angleScore;
	}

	public double getAngleTime() {
		return angleTime;
	}

	public String getText() {
		return text;
	}

	public float[] getCharScores() {
		return charScores;
	}

	public double getCrnnTime() {
		return crnnTime;
	}

	public double getBlockTime() {
		return blockTime;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;
		OcrTextBlock textBlock = (OcrTextBlock) o;
		return Float.compare(textBlock.boxScore, boxScore) == 0 && angleIndex == textBlock.angleIndex
				&& Float.compare(textBlock.angleScore, angleScore) == 0
				&& Double.compare(textBlock.angleTime, angleTime) == 0
				&& Double.compare(textBlock.crnnTime, crnnTime) == 0
				&& Double.compare(textBlock.blockTime, blockTime) == 0 && Objects.equals(boxPoint, textBlock.boxPoint)
				&& Objects.equals(text, textBlock.text) && Arrays.equals(charScores, textBlock.charScores);
	}

	@Override
	public int hashCode() {
		int result = Objects.hash(boxPoint, boxScore, angleIndex, angleScore, angleTime, text, crnnTime, blockTime);
		result = 31 * result + Arrays.hashCode(charScores);
		return result;
	}

	@Override
	public String toString() {
		return "TextBlock{" + "boxPoint=" + boxPoint + ", boxScore=" + boxScore + ", angleIndex=" + angleIndex
				+ ", angleScore=" + angleScore + ", angleTime=" + angleTime + ", text='" + text + '\'' + ", charScores="
				+ Arrays.toString(charScores) + ", crnnTime=" + crnnTime + ", blockTime=" + blockTime + '}';
	}
}
